package HibernateOrderManagerment.bean;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Table(name="store_goods")
@Entity
public class StoreGoods {
	@Id
	@Column(name="id")
	private long id;
	@Column(name="price")
	private int price;
//	@Column(name="store_id")
//	private long storeId;
//	@Column(name="goods_id")
//	private long goodsId;
//	@Column(name="goods_status_id")
//	private long goodsStatusId;
	
	@ManyToOne
	@JoinColumn(name="store_id")
	private Store store;
	@ManyToOne
	@JoinColumn(name="goods_id")
	private Goods goods;
	@ManyToOne
	@JoinColumn(name="goods_status_id")
	private GoodsStatus goodsStatus;
	@OneToMany
	@JoinColumn(name="store_goods_id")
	private Set<OrderItem> orderItems;
	
//	private String storeName;
//	private String type;
//	private String goodsName;
//	private String statusName;
	
	public StoreGoods(){
		id=-1;
	}

//	public String getStoreName() {
//		return storeName;
//	}
//	public void setStoreName(String storeName) {
//		this.storeName = storeName;
//	}
//	public String getType() {
//		return type;
//	}
//	public void setType(String type) {
//		this.type = type;
//	}
//	public String getGoodsName() {
//		return goodsName;
//	}
//	public void setGoodsName(String goodsName) {
//		this.goodsName = goodsName;
//	}
//	public String getStatusName() {
//		return statusName;
//	}
//	public void setStatusName(String statusName) {
//		this.statusName = statusName;
//	}
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}



	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	public GoodsStatus getGoodsStatus() {
		return goodsStatus;
	}

	public void setGoodsStatus(GoodsStatus goodsStatus) {
		this.goodsStatus = goodsStatus;
	}
	

	public Set<OrderItem> getOrderItems() {
		return orderItems;
	}

	public void setOrderItems(Set<OrderItem> orderItems) {
		this.orderItems = orderItems;
	}

	@Override
	public String toString() {
		return "StoreGoods [id=" + id + ", price=" + price + ", storeId=" + store.getId() + ", goodsId=" + goods.getId() + ", goodsStatusId="
				+ goodsStatus.getId()+ "]";
	}

//	@Override
//	public String toString() {
//		return "StoreGoods [id=" + id + ", price=" + price + "]";
//	}
	
	

}
